package com.sakura.动态规划;

import java.io.*;

// 节点数为n高度不大于m的二叉树个数
// 现在有n个节点，计算出有多少个不同结构的二叉树
// 满足节点个数为n且树的高度不超过m的方案
// 因为答案很大，所以答案需要模上1000000007后输出
// 测试链接 : https://www.nowcoder.com/practice/aaefe5896cce4204b276e213e725f3ea
public class Code9999_二叉树不同结构限定高度 {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        while (in.nextToken() != StreamTokenizer.TT_EOF) {
            int n = (int) in.nval;
            in.nextToken();
            int m = (int) in.nval;
            out.println(compute3(n, m));
        }
        out.flush();
        out.close();
        br.close();
    }


    public static int MAXN = 51;

    public static int MOD = 1000000007;

    // 递归
    public static int compute1(int n, int m) {
        if (n == 0) return 1;
        if (m == 0) return 0;
        long ans = 0;
        for (int k = 0; k < n; k++) {
            // 因为根节点已经占用 一层了 所有m - 1
            ans = (ans + ((long) compute1(k, m - 1) * compute1(n - k - 1, m - 1)) % MOD) % MOD;
        }
        return (int) ans;
    }

    // 记忆化搜索
    public static long[][] dp1 = new long[MAXN][MAXN];

    static {
        for (int i = 0; i < MAXN; i++) {
            for (int j = 0; j < MAXN; j++) {
                dp1[i][j] = -1;
            }
        }
    }
    public static int compute2(int n, int m) {
        if (n == 0) return 1;
        if (m == 0) return 0;
        if (dp1[n][m] != -1) return (int) dp1[n][m];
        long ans = 0;
        for (int k = 0; k < n; k++) {
            ans = (ans + ((long) compute2(k, m - 1) * compute2(n - k - 1, m - 1)) % MOD) % MOD;
        }
        dp1[n][m] = ans;
        return (int) (ans);
    }


    // 严格位置依赖的动态规划
    public static long[][] dp2 = new long[MAXN][MAXN];
    public static int compute3(int n, int m) {
        if (n == 0) return 1;
        if (m == 0) return 0;
        for (int i = 0; i <= m; i++) {
            dp2[0][i] = 1;
        }

        for (int i= 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
               dp2[i][j] = 0;
               for (int k = 0; k < i; k++) {
                   dp2[i][j] = (dp2[i][j] + (dp2[k][j - 1] * dp2[i - k - 1][j - 1]) % MOD) % MOD;
               }
            }
        }
        return (int) dp2[n][m];
    }
}
